/**
 * 公用参数
 */
var current='';//当前界面进入
var otherInfo=null
var titleInfo=null



/**
 * 默认加载
 * @type {{init: Window.process.init, public: Window.process.public}}
 */
window.process = {
    init () {
        this.initData();

    },
    initData () {
        var paramsData = getUrlParamsCode();
        current= paramsData['current'];
        this.load()

    },
    load(){
        var api='/appFamMembes/find'
        otherInfo=JSON.parse(localStorage.getItem('otherInfo'))
        titleInfo=JSON.parse(localStorage.getItem('titleInfo'))
		cardInfo=JSON.parse(localStorage.getItem('cardInfo'))
        var data={
            openId:localStorage.openid,
            cardno:cardInfo.cardno,
            idCard:cardInfo.idCard,
            cardtype:cardInfo.cardtype,
            doctorcode:!!titleInfo?titleInfo.doctorcode:'',
            phoneNo:cardInfo.phone
        }
        postAjax(api,data,this.callbackLoad,this)
    },
    callbackLoad(data,that){
        $.each(data,function(index,value){
            // data.push({
            //     age:data[index].csrq
            // })
            data[index].age=getAge(value.csrq)

        });
        var Data={
            list:data
        };
        var listHtml = template('list_data', Data);
        $("#list_data_content").html(listHtml);
        that.public();
    },
    public() {
       //添加就诊人
        $('#edit').click(function () {
            window.location.href='visiter_add.html';

        });
        //进入详情
        $('.list .item').click(function () {
            var name=$(this).attr('data-name');
            var idcard=$(this).attr('data-idcard');
            var cardno=$(this).attr('data-cardno');
            var cardtype=$(this).attr('data-cardtype');
            var idcardtype=$(this).attr('data-idcardtype');
            if(current=='payment') {
                window.location.href='payment.html?name='+name+'&idcard='+idcard+'&cardno='+cardno+'&cardtype='+cardtype+'&idcardtype='+idcardtype;
            }
            else if(current=='report'){
                window.location.href='report.html?name='+name+'&idcard='+idcard+'&cardno='+cardno+'&cardtype='+cardtype+'&idcardtype='+idcardtype;
            }
            else{
                window.location.href='make_detail.html?name='+name+'&idcard='+idcard+'&cardno='+cardno+'&cardtype='+cardtype+'&idcardtype='+idcardtype;
            }
        });

    }
};

/**
 * 启动方法执行
 */
process.init();



